package com.snoopy.cloud.service.impl;

import com.snoopy.cloud.entity.Account;
import com.snoopy.cloud.entity.AccountDTO;
import com.snoopy.cloud.mapper.AccountMapper;
import com.snoopy.cloud.service.AccountService;
import jakarta.annotation.Resource;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

/**
 * @author snoopy23
 * @date 2024/6/27
 */
@Service
public class AccountServiceImpl implements AccountService {
    @Resource
    private AccountMapper accountMapper;
    @Override
    public List<Account> list(AccountDTO accountDTO) {
        Example ae = new Example(Account.class);
        if(StringUtils.isNotBlank(accountDTO.getName())){
            ae.createCriteria().andEqualTo("name",accountDTO.getName());
        }
        return accountMapper.selectByExample(ae);
    }
}
